package com.api.oa.mapper;

import com.api.oa.model.entity.YQTrack;
import com.api.oa.model.vo.OaNoticeVo;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface YQTrackMapper {

    @Insert("insert into  yq_track  (" +
            "taskId," +
            "lat," +
            "lng," +
            "userId," +
            "timestamp" +
            ") " +
            "values " +
            "(" +
            "#{entity.taskId}," +
            "#{entity.lat}," +
            "#{entity.lng}," +
            "#{entity.userId}," +
            "#{entity.timestamp}" +
            ")")
    @Options(useGeneratedKeys = true, keyProperty = "trackId", keyColumn = "id")
    Integer insert(@Param("entity") YQTrack entity);


    @Update("update  yq_track  set " +
            "trackId = #{entity.trackId}," +
            "taskId = #{entity.taskId}," +
            "lat = #{entity.lat}," +
            "lng = #{entity.lng}," +
            "userId = #{entity.userId}," +
            "timestamp = #{entity.timestamp}," +
            " where trackId = #{entity.trackId}")
    Integer update(@Param("entity") YQTrack entity);


    @Delete("delete from yq_track where trackId=#{id}")
    void delete(@Param("id") Long id);


    @Select("select * from  yq_track  where taskId = #{id}")
    List<YQTrack> list(@Param("id") Long pid);


    @Select("select * from  yq_track  where taskId = #{id}")
    List<YQTrack> all(@Param("id") Long pid);


    @Select("select * from  yq_track  where trackId = #{id} limit 1")
    YQTrack findOne(@Param("id") Long id);

}

